<!-- saved from url=(0026)/test.html -->
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    <title>马蜂窝问答,解决旅行问题,基于旅游的问答分享平台 - 马蜂窝</title>
    <meta name="viewport"
          content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no,minimal-ui,viewport-fit=cover">
    <meta name="format-detection" content="telephone=no,address=no">

    <link href="/css/mobile+css+head_mobile+css+ui^YVw^1526627473.css" rel="stylesheet" type="text/css">

    <link href="/css/new_ask2016.css" rel="stylesheet" type="text/css">

    <script src="/js/plugins/jquery/jquery.min.js"></script>
    <script src="/js/plugins/form/jquery.form.js"></script>
    <script src="/js/plugins/jrender/jrender.min.js"></script>
    <link rel="stylesheet" href="/js/plugins/dialog2/dialog.css"/>
    <script src="/js/plugins/dialog2/dialog.min.js"></script>
    <script src="/js/common.js"></script>
    <script>

        // 记录浏览数
        function addview(qid) {
            $.ajax({
                type: "PUT",
                url: "/questions/"+qid+"/addviews"
            })
        }

        // 分页数据
        var currentPage = 1;
        var totalPage;
        var questionArr = [];

        // 查询问题
        function getQuestions() {
            $.get('/questions/', {currentPage: currentPage, pageSize: 5}, function (data) {
                $.merge(questionArr, data.list);
                var json = {
                    list: questionArr
                };
                // 渲染数据
                $("._j_pager_box").renderValues(json, {
                    getHref: function (item, value) {
                        var href = $(item).data("href");
                        $(item).attr('href', href + value);
                        $(item).attr('onclick', "addview("+value+")");
                    }
                });
                totalPage = data.lastPage;
                currentPage = currentPage + 1;
            });
        }

        $(function (){
            var user = JSON.parse(sessionStorage.getItem("user"));
            getQuestions();

            // 点击更多加载更多
            $("._j_add_more_button").click(function () {
                if (totalPage >= currentPage){
                    getQuestions();
                }else{
                    $(document).dialog({
                        type : 'notice',
                        infoText: '没有更多啦',
                        autoClose: 1000,
                        position: 'bottom'  // center: 居中; bottom: 底部
                    });
                }
            });

            $(".btn-que").click(function () {
                if (!user) {
                    $(document).dialog({
                        type : 'confirm',
                        closeBtnShow: true,
                        content: '登陆后才可以提问, 现在登录?',
                        onClickConfirmBtn: function(){
                            location.href = "/login.html?authorId=666";
                        }
                    });
                }else{
                    location.href = "/mine/ask.html"
                }
            });

            $("#keySearch").ajaxForm(function (data) {

            })
        })
    </script>
</head>
<body >
<div id="pos38"></div>
<header class="MfwHead ">
    <div class="LBtn"><a class="btn back" href="javascript:void(window.history.length &gt; 1 ? window.history.back() : document.location.href= '/index.html')"
                         id="_j_top_history_back"></a>
    </div>
    <div class="CBtn"><h1>骡窝窝问答</h1></div>
    <div class="rBtn">
        <a href="/index.html" class="home" ></a>
        <a href="#" class="search"></a>
    </div>
</header>

<input type="hidden" name="currentPage" id="currentPage" value="1">

<div>
    <img src="/img/h5_banner.jpg" style="width: 100%">
</div>
<section class="search mdd-searchbar" id="mdd_search">
    <form id="keySearch" action="/questions" method="get" >
        <div class="con">
            <label class="ico" id="_j_wenda_seach_button"><i></i></label>
            <div class="con-ico _j_submit_search " id="pnl_j_submit_search"><i class="focus"></i></div>
            <div class="con-input">
                <input type="text" name="keyword" id="pnl_search" class="_j_wenda_seach_input">
                <i class="del" id="fixed_delvalue"></i>
            </div>
        </div>
    </form>
    <ul class="_j_mdd_suggest _j_suggest_box" style="z-index: 10"></ul>
</section>

<section class="ans-list a-list">
    <ul class="_j_pager_box">
        <div id="divv" render-loop="list">
            <li class="qq">
                <a class="qqq" data-href="/answer.html?id=" render-key="list.id" render-fun="getHref" >
                    <h2 render-html="list.title"></h2>
                    <div class="clearfix">
                        <div class="user-img clearfix">
                            <p>
                                <img render-src="list.user.headImgUrl">
                            </p>
                            <span render-html="list.user.nickName"></span>
                        </div>
                        <div class="ans-nr">
                            <div class="clearfix">
                                <div class="pic"><img render-src="list.coverUrl">
                                </div>
                                <p render-html="list.content"></p>
                            </div>
                            <div class="clearfix">
                                <span class="fl-l" render-html="list.place"></span>
                                <span class="fl-r"><b render-html="list.viewCount"></b>浏览<b render-html="list.answerCount"></b>回答<b render-html="list.likeCount"><em ></em></b><em>顶</em></span>
                            </div>
                        </div>
                    </div>
                </a>
            </li>
        </div>
    </ul>
    <div style="margin-bottom: 65px;">
        <a class="more-list _j_add_more_button">更多问题</a>
    </div>
</section>

<section class="askfoot">
    <a  class="btn-que"><i></i>
        我要提问
    </a>
</section>

</body>
</html>